"use strict";
cc._RF.push(module, '9309esBqQZH45/FiCWiFaah', 'WebSDK');
// scripts/WebSDK.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _n30,
    i = void 0 && (void 0).__extends || (_n30 = function n(t, e) {
  return (_n30 = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _n30(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
});

Object.defineProperty(o, "__esModule", {
  value: !0
});

var s = t("BaseSdk"),
    r = t("PlatfromEnum"),
    c = t("Common"),
    a = function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e.accChangeBack = null, e;
  }

  return i(e, t), e.prototype.init = function () {// var t = c.default.host + "/getConfig";
    // this.sendHttpRequest(
    //     t,
    //     {app: "cfg_des_ball"},
    //     function (t) {
    //         if ("true" == t.config.stop) {
    //             var e = new cc.Event.EventCustom("stopG", !1);
    //             cc.director.dispatchEvent(e);
    //         }
    //         "true" == t.config.gravity &&
    //             ((e = new cc.Event.EventCustom("gravityG", !1)), cc.director.dispatchEvent(e)),
    //             "false" == t.config.ttOpenUgc &&
    //                 ((e = new cc.Event.EventCustom("closeUgc", !1)), cc.director.dispatchEvent(e));
    //     },
    //     function () {}
    // );
  }, e.prototype.login = function (t) {
    var e = {
      platform: r["default"].WEB,
      openId: "6WcESXZN32OKtAI6",
      nickName: t.nickName
    };
    this.sendHttpRequest(c["default"].simpleLoginUrl, e, function (e) {
      if (console.log("请求成功", e), e.ok) if (0 == e.error) {
        var o = e.data;
        0 == o.user.status ? (console.log("登录完成，准备回调"), t.success(o)) : (console.log("用户状态异常"), t.fail("你因违规操作,帐号已被系统冻结"));
      } else t.fail(e.error);
    }, function () {
      console.log("request调用失败"), t.fail("服务器繁忙，请稍后再试。");
    });
  }, e.prototype.registerAccChange = function (t) {
    this.accChangeBack = t, cc.systemEvent.setAccelerometerEnabled(!0), cc.systemEvent.on(cc.SystemEvent.EventType.DEVICEMOTION, this.onAccChange, this);
  }, e.prototype.unRegisterAccChange = function () {
    cc.systemEvent.setAccelerometerEnabled(!1), cc.systemEvent.off(cc.SystemEvent.EventType.DEVICEMOTION, this.onAccChange, this);
  }, e.prototype.onAccChange = function (t) {
    var e = t.acc.x.toFixed(2),
        o = t.acc.y.toFixed(2);
    this.accChangeBack(e, o, 0, this);
  }, e;
}(s["default"]);

o["default"] = a;

cc._RF.pop();